package org.fast.easy.auth.service;

import me.zhyd.oauth.model.AuthUser;
import org.fast.easy.core.domain.auth.form.RegisterBody;
import org.fast.easy.core.domain.auth.model.LoginUser;
import org.fast.easy.core.domain.auth.model.XcxLoginUser;
import org.fast.easy.core.enums.LoginType;
import org.fast.easy.framework.exception.user.UserException;
import org.fast.easy.system.upms.domain.vo.SysUserVo;

import java.util.function.Supplier;

public interface ISysLoginService{
    /**
     * 绑定第三方用户
     *
     * @param authUserData 授权响应实体
     */
    public void socialRegister(AuthUser authUserData);

    public void checkTenant(String tenantId);

    public void register(RegisterBody registerBody);

    public LoginUser getLoginUserInfoByUsername(String username, String tenantId);
    public LoginUser getLoginUserInfoByUserId(Long userId, String tenantId);
    public LoginUser getLoginUserInfoByPhonenumber(String phonenumber, String tenantId);
    public LoginUser getLoginUserInfoByEmail(String email, String tenantId);
    public XcxLoginUser getUserInfoByOpenid(String openid) throws UserException;
    public LoginUser buildLoginUser(SysUserVo userVo);

    /**
     * 退出登录
     */
    public void logout();
    /**
     * 校验验证码
     *
     * @param username 用户名
     * @param code     验证码
     * @param uuid     唯一标识
     */
    public void validateCaptcha(String tenantId, String username, String code, String uuid) ;
    /**
     * 记录登录信息
     *
     * @param username 用户名
     * @param status   状态
     * @param message  消息内容
     * @return
     */
    public void recordLogininfor(String tenantId, String username, String status, String message);

    /**
     * 登录校验
     */
    public void checkLogin(LoginType loginType, String tenantId, String username, Supplier<Boolean> supplier);
    public void recordLoginInfo(Long userId, String ip);
}
